/*
 * @Author: 谢小康 2170673706@qq.com
 * @Date: 2023-12-16 17:53:23
 * @LastEditors: 谢小康 2170673706@qq.com
 * @LastEditTime: 2023-12-17 17:05:30
 * @FilePath: \My-bolg\server\model\lables.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

const { DataTypes } = require('sequelize');
const sq = require('./db.js')
const moment = require('moment')
const Lables = sq.define('lables', {
    lable_name: {
        type: DataTypes.STRING,
        allowNull: false,
        require:true,
        comment: "标签名字",
        unique:true
    },
    createdAt: {
        type: DataTypes.DATE,
        get() {
            return moment(this.getDataValue("createdAt")).format("YYYY-MM-DD HH:mm:ss")
        },
    },
    updatedAt: {
        type: DataTypes.DATE,
        get() {
            return moment(this.getDataValue("updatedAt")).format("YYYY-MM-DD HH:mm:ss")
        },
    },
}, {
    // 这是其他模型参数
    freezeTableName: true,
});
/* Lables.sync({ force: true }) */
module.exports = Lables;